A good answer might be:

Yes.


Re-entrant Code

An iterative version of the Fibonacci series is certainly possible, since an iterative version of a recursive program always is possible. It runs much faster than the recursive version. You may wish to figure it out.

As the example recursive methods execute, there are several activations of the same method on the activation chain. Each activation is an individual entity that embodies a particular evaluation of the method with particular parameters. In the activation chain, the activation for Fib(5) is an individual entity that calls for the creation of other entities, the activation of Fib(4) and Fib(3).

An activation is somewhat like a software object. An activation follows the method for its code (like an object follows a class) but has its own values for parameters (like an object has its own values for its instance values).

Not all programming languages allow this. Old versions of FORTRAN allow only one activation of any subroutine (its equivalent of a method).

A re-entrant method is one that may have multiple, simultaneous activations which do not interfere with each other. Methods in Java and all modern languages are re-entrant.

Re-entrant code is important for more than just recursion. For example, the windows displayed in the user interface of a modern operating system are all controlled by the same software. The methods of this software are re-entrant, so that only one copy is needed in memory no matter how many windows and icons are on the display.

QUESTION 20:

Are you using re-entrant code right now?